<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微信能力</title>
</head>

<body>
    <!-- <script src="https://g.517cdn.com/jQ/jquery-1.9.0.min.js"></script> -->
    <script src="../src/jquery-1.9.1.min.js"></script>
    <script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script>
        var ua = window.navigator.userAgent.toLowerCase();

        if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(ua)){
            console.log("手机端");
        }else{
            console.log("pc端");
        }

        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            // 微信中
            wx.miniProgram.getEnv((res) => {
                if (res.miniprogram) {
                    // 小程序中
                    wx.miniProgram.navigateTo({ url: '/pages/buy/detail' })
                } else {
                    location.href = 'https://www.baidu.com';
                }
            })
        }else{
            console.log("手机端")
        }

        // jssdk =================================

        // 浏览器唤起本地微信APP =================================
        // URL Scheme打开小程序
        // location.href = 'weixin://dl/business/?t= *TICKET*'
    </script>
</body>

</html>